Skip to content

Allow capability DONs to include OCR attestation of the responses#1907

Open
dhaidashenko wants to merge 1 commit intomainfrom
feature/PLEX-2611-pass-ocr-attestation-to-workflow-don
Open

Allow capability DONs to include OCR attestation of the responses#1907
dhaidashenko wants to merge 1 commit intomainfrom
feature/PLEX-2611-pass-ocr-attestation-to-workflow-don

Conversation

@dhaidashenko
Copy link
Contributor

@dhaidashenko dhaidashenko commented Mar 19, 2026

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-common

⚠️ Breaking Changes (1)

pkg/types/llo.ChannelDefinition (1)
  • DisableNilStreamValues — 🗑️ Removed

✅ Compatible Changes (9)

pkg/capabilities (3)
  • AttributedSignature — ➕ Added

  • ResponseOCRAttestation — ➕ Added

  • ResponseToReportData — ➕ Added

pkg/capabilities.ResponseMetadata (1)
  • OCRAttestation — ➕ Added
pkg/capabilities/pb (2)
  • AttributedSignature — ➕ Added

  • ResponseOCRAttestation — ➕ Added

pkg/capabilities/pb.(*ResponseMetadata) (1)
  • GetOcrAttestation — ➕ Added
pkg/capabilities/pb.ResponseMetadata (1)
  • OcrAttestation — ➕ Added
pkg/types/llo.ChannelDefinition (1)
  • AllowNilStreamValues — ➕ Added

📄 View full apidiff report

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

✅ API Diff Results - github.com/smartcontractkit/chainlink-common/keystore

✅ Compatible Changes (1)

corekeys/ocr2key (1)
  • EvmVerifyBlob — ➕ Added

📄 View full apidiff report

@dhaidashenko dhaidashenko marked this pull request as ready for review March 19, 2026 16:14
@dhaidashenko dhaidashenko requested review from a team as code owners March 19, 2026 16:14
Copilot AI review requested due to automatic review settings March 19, 2026 16:14
@dhaidashenko dhaidashenko requested review from bolekk and removed request for ilija42 March 19, 2026 16:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the capabilities response metadata to optionally carry an OCR attestation (config digest, sequence number, and attributed signatures), enabling Capability DONs to include OCR-style attestations alongside responses.

Changes:

  • Added ocr_attestation (with ResponseOCRAttestation + AttributedSignature) to ResponseMetadata in the capabilities protobuf schema.
  • Updated Go capability types and pb helper conversions to serialize/deserialize OCR attestation data.
  • Added test coverage for attestation round-tripping and invalid config digest length handling; refactored EVM keyring blob verification into a reusable function.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/capabilities/pb/capabilities_helpers_test.go Adds subtests for invalid digest length and round-trip conversion including OCR attestation metadata.
pkg/capabilities/pb/capabilities_helpers.go Adds OCR attestation marshaling/unmarshaling logic to capability response proto helpers.
pkg/capabilities/pb/capabilities.proto Introduces ocr_attestation on ResponseMetadata and new messages for attestation + signatures.
pkg/capabilities/pb/capabilities.pb.go Regenerated protobuf Go output for the updated schema.
pkg/capabilities/capabilities.go Adds OCR attestation types to response metadata and introduces ResponseToReportData hashing helper.
keystore/corekeys/ocr2key/evm_keyring.go Extracts EVM blob verification into EvmVerifyBlob and reuses it from the keyring method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OCR attestation metadata support to capability responses so Capability DONs can include verifiable OCR context (config digest, sequence number, signatures) alongside the response.

Changes:

  • Extend ResponseMetadata protobuf schema with an optional ocr_attestation message (including attributed signatures).
  • Update Go conversion helpers to marshal/unmarshal OCR attestation between internal types and protobuf types, plus add round-trip/validation tests.
  • Introduce response-to-report hashing helper and extract EVM blob verification into a reusable function.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/capabilities/pb/capabilities.proto Adds ResponseOCRAttestation + AttributedSignature and wires it into ResponseMetadata.
pkg/capabilities/pb/capabilities.pb.go Regenerated protobuf Go types to include the new messages/field.
pkg/capabilities/pb/capabilities_helpers.go Adds proto ↔ internal mapping for OCR attestation on capability responses.
pkg/capabilities/pb/capabilities_helpers_test.go Adds validation + round-trip coverage for response OCR attestation conversions.
pkg/capabilities/capabilities.go Adds internal OCR attestation types and ResponseToReportData hashing helper.
keystore/corekeys/ocr2key/evm_keyring.go Extracts EVM blob verification into EvmVerifyBlob and reuses it from the keyring method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +193 to +197
attestation = &capabilities.ResponseOCRAttestation{
ConfigDigest: [32]byte(pr.Metadata.OcrAttestation.ConfigDigest),
SequenceNumber: pr.Metadata.OcrAttestation.SequenceNumber,
Sigs: make([]capabilities.AttributedSignature, len(pr.Metadata.OcrAttestation.Signatures)),
}
Comment on lines +101 to +116
func ResponseToReportData(requestID string, responsePayload []byte, spendUnit, spendValue string) []byte {
hash := sha3.New256()
const domainSeparator = "CapabilityResponseReportData:v1"
hash.Write([]byte(domainSeparator))
// Helper to write a length-prefixed byte slice.
writeField := func(b []byte) {
// Use a fixed-width length prefix to make encoding unambiguous.
_ = binary.Write(hash, binary.BigEndian, uint64(len(b)))
_, _ = hash.Write(b)
}
writeField([]byte(requestID))
writeField(responsePayload)
writeField([]byte(spendUnit))
writeField([]byte(spendValue))

return hash.Sum(nil)
Comment on lines +114 to +122
func EvmVerifyBlob(pubkey types.OnchainPublicKey, b, sig []byte) bool {
authorPubkey, err := crypto.SigToPub(b, sig)
if err != nil {
return false
}
authorAddress := crypto.PubkeyToAddress(*authorPubkey)
// no need for constant time compare since neither arg is sensitive
return bytes.Equal(pubkey[:], authorAddress[:])
}
@dhaidashenko dhaidashenko force-pushed the feature/PLEX-2611-pass-ocr-attestation-to-workflow-don branch from 82a189c to 76aac32 Compare March 19, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants